import Vue from 'vue'
import Vuex from 'vuex'

import dicts from './sys/dicts'
import parameters from './sys/parameters'
import users from './sys/users'
import tagsView from './common/tagsView'
import warehouse from './bus/warehouse'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    appName: 'TestApplication',
    appVersion: '2.0',
    // 全局配置信息
    config: {
      reportTitle: 'fortec shanghai',
      defaultRows: 15
    },
    // 显示主页菜单的控制信号
    workbenchActive: true,
    workbenchRoute: { name: '/' },
    // menu
    menus: []
  },
  getters: {
    menuGetter: state => state.menus
  },
  mutations: {
    SET_WORKBENCH_ACTIVE: (state, value) => {
      state.workbenchActive = value
    },
    SET_WORKBENCH_ROUTE: (state, value) => {
      state.workbenchRoute = value
      state.workbenchActive = value.name == 'dashboard'
    },
    SET_MENUS: (state, value) => {
      state.menus = value
    }
  },
  actions: {},
  modules: {
    dicts,
    parameters,
    users,
    tagsView,
    warehouse
  }
})
